/*
 * $Id: TestADIFParser.m 34 2009-04-21 20:24:55Z jon@bway.net $
 * Chalk
 *
 * Created 2/19/09
 * Copyright Jon Gordon
 * 
 * Permission is hereby granted, free of charge, to any person obtaining 
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including 
 * without limitation the rights to use, copy, modify, merge, publish, 
 * distribute, sublicense, and/or sell copies of the Software, and to 
 * permit persons to whom the Software is furnished to do so, subject to 
 * the following conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#import "TestADIFParser.h"

#import "QEADIFParser.h"


static NSString *ADIF_SRC1 = @"<CALL:6>cx4aaj\n<BAND:3>15M\n<MODE:4>RTTY\n<QSO_DATE:8>20080928\n<TIME_ON:6>183200\n<FREQ:6>21.106\n<EOR>\n<CALL:4>n2bj\n<BAND:3>40M\n<MODE:5>PSK31\n<QSO_DATE:8>20081004\n<TIME_ON:6>000000\n<FREQ:5>7.072\n<EOR>\n<CALL:5>ai4of\n<BAND:3>40M\n<MODE:5>PSK31\n<QSO_DATE:8>20081004\n<TIME_ON:6>010700\n<FREQ:5>7.072\n<EOR>\n";

@implementation TestADIFParser
- (void)testParsing
{
    QEADIFParser *parser = [[QEADIFParser alloc] init];
    STAssertNotNil(parser, @"failed to allocate parser with default initializer");
    [parser release];
    
    parser = [[QEADIFParser alloc] initWithSrc:ADIF_SRC1];
    STAssertNotNil(parser, @"failed to allocate parser with source text");
    QEADIFFile *adifFile = [parser parseSource];
    STAssertNotNil(adifFile, @"failed to generate structure representing ADIF file");
    [parser release];
    
    STAssertNotNil(parser, @"failed to allocate parser with source text");
    adifFile = [QEADIFParser recordsFromSrcString:ADIF_SRC1];
    STAssertNotNil(adifFile, @"failed to generate structure representing ADIF file");
    
    STAssertNotNil(parser, @"failed to allocate parser with source text");
    adifFile = [QEADIFParser recordsFromSrcFile:@"/Volumes/lawnrrd/Documents/Projects+Reference/ham stuff/LotW/rumble.adi"];
    STAssertNotNil(adifFile, @"failed to generate structure representing ADIF file");
}  // testParsing
@end
